/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意：
* 本软件为www.yixiang.co开发研制，未经购买不得使用
* 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
* 一经发现盗用、分享等行为，将追究法律责任，后果自负
*/
package co.yixiang.modules.auction.service.mapper;

import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.auction.domain.AuctionOrder;
import co.yixiang.modules.auction.service.dto.AuctionOrderDto;
import co.yixiang.modules.auction.service.dto.AuctionOrderQueryCriteria;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* @author yhh
* @date 2021-02-18
*/
@Repository
public interface AuctionOrderMapper extends CoreMapper<AuctionOrder> {


    @Select("<script> select a.*,u.real_name as nickname,ap.title as productName , yu2.phone  , yu1.phone as buyPhone from yx_auction_order a left join yx_authentication u on a.user_id= u.uid " +
            " LEFT JOIN yx_user yu2 on yu2.uid = a.user_id left join yx_auction_record ar on a.auction_record_id=ar.id LEFT JOIN yx_user yu1 on yu1.uid = ar.user_id " +
            " left join yx_auction_product ap on ar.auction_product_id=ap.id where 1=1 " +
            " <if test=\"nickname != null and nickname != ''\"> and u.real_name  like CONCAT('%',#{nickname},'%') </if> " +
            " <if test=\"productName != null and productName != ''\"> and ap.title  like CONCAT('%',#{productName},'%')  </if> " +
            " <if test=\"buyPhone != null and buyPhone != ''\"> and yu2.phone  like CONCAT('%',#{buyPhone},'%')  </if> " +
            " <if test=\"status != null\"> and a.status =#{status} </if> </script>")
    List<AuctionOrderDto> getAuctionList(AuctionOrderQueryCriteria criteria);



}
